<template>
  <div class="panel">
    <span class="minus" @click="handleMinus">-</span>
    <span class="num">{{ count }}</span>
    <span class="plus" @click="handlePlus">+</span>
  </div>
</template>

<script>
export default {
  name: "btn",
  props: {
    count: {
      type: Number,
      default: 1,
    },
  },
  methods: {
    handleMinus() {
      this.$emit("minus");
    },
    handlePlus() {
      this.$emit("plus");
    },
  },
};
</script>

<style lang="scss" scoped>
@import "@/styles/variables.scss";
.panel {
  width: 0.6rem;
  height: 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .num {
    box-sizing: border-box;
    display: inline-block;
    width: 0.2rem;
    text-align: center;
    color: $medium-font-color;
  }
  .plus,
  .minus {
    box-sizing: border-box;
    display: inline-block;
    width: 0.18rem;
    height: 0.18rem;
    border-radius: 50%;
    line-height: 0.16rem;
    text-align: center;
    font-size: 0.14rem;
    border: solid 1px $light-font-color;
    color: $medium-font-color;
  }
  .plus {
    display: inline-block;
    border: none;
    background-color: $btn-color;
    color: #fff;
  }
}
</style>
